<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查看订单</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <script src="Bootstrap/js/jquery-1.11.1.min.js"></script>
    <link href="Bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
        *{margin: 0;padding: 0px;list-style: none}
        header{background-color: #20a1a1;height: 40px;width: 100%;color: white;line-height: 40px;text-align: center}
        .back{font-size: 13px;font-weight: bold;margin-left: 10px;display: inline-block;float: left}
        ul{background-color: #F0F0F0;position: fixed;top: 40px;height: 40px;}
        .main img{width: 100px;height: 100px;border-radius: 10px;margin: 5px 0px 5px 5px}
        ul{background-color: 	#F0F0F0}
        .hotInfo li{width: 100%;height: 110px;margin-top: 2px;background-color: white}
        .product_title{position: absolute;margin-left: 2%;font-size: 13px;padding: 3px;color: black;width: 49%;font-weight: bold}
        .price{color: red;font-size: 12px;float: right;font-weight: bold;margin: 4% 3% 0 0}
        .number{color: black;font-size: 12px;float: right;font-weight: bold;margin: 11% -6% 0 0;}
        .state{display: inline-block;float:right;margin:20% -7% 0 0;font-size: 13px;color: red}
        .orderCode,.orderTime,.code{position: absolute;font-size: 13px;color: black}
        .orderCode{margin: 12% 0 0 4%}
        .orderTime{margin: 26% 0 0 4%}
        .code{margin: 19% 0 0 4%}
        .wrapper{  width:100%;  height: 475px;  margin: 0 auto;  }
        .tab{ border:1px solid #ddd;  border-bottom: 0;  height: 36px;  width: 320px;}
        .tab li{  float: left;font-size: 13px;color: grey; border-bottom: 0;   border-bottom: 1px solid #f7f7f7;   width: 33%;  height: 40px;  line-height: 45px;  text-align: center;  cursor: pointer;  background-color: white;  }
        .tab li.active{  border-bottom: 0;  color: peru;  border-bottom: 1px solid peru;  }
        .products{  width: 100%;  border:0px solid blue;  height: 476px;}
        .products .main{  width: 100%;  float: left;  height: 50px;  margin-top: 40px;  border: 0px solid red;  display: none;  }
        .products .main.selected{display: block;}
        .main ul{  width: 100%;  background-color: white;  border: 0px solid gold;   margin-top: 45px;  }
        .main li{  height: 120px;  border-bottom: 4px solid #f8f8ff;  margin-top: 2px;  }
        #footer_top { background-color: ghostwhite;width: 100%;height: 55px}
        .navigation { width: 25%;float: left;height: 55px;}
        .home_img {width: 60px; height: 100%; margin: 0 auto;}
        .home_img img { margin-left: 17px;width: 25px;height: 25px;margin-top: 5px;}
        .spa{color: gray;width: 25%;margin-top: -2px;;font-size: 12px;text-align: center;  }
        a:link {text-decoration: none;        }
        #footer_top { background-color:#f8f8ff;width: 100%; height: 50px;;     }
        .navigation { width: 25%; float: left;height: 55px;     }
        .home_img { width: 60px;height: 100%;margin: 0 auto;      }
        .home_img img {margin-left: 17px;width: 25px;height: 25px; margin-top: 5px;        }
        .spa{ color: gray;width: 60px;font-size: 12px; text-align: center;       }
    </style>
    <script type="text/javascript">
        $(document).ready(function(){
            $(".tab>li").mouseenter(function(){
                $(this).addClass("active").siblings("li").removeClass("active");
                var index=$(this).index();
                $(".main").eq(index).addClass("selected").siblings(".main").removeClass("selected");
            });
        });
    </script>
</head>
<body>
<script>
    var id;
    var state = 0;
    $(function () {
        id = 2;
        order(state);
    })
    function order(stat) {
        state = stat;
        $.ajax({
            url: "http://obao.tunnel.2bdata.com/order_orders.htm?id="+id+"&state="+state,
            type: "post",
            success:function (data) {
                var title;
                var node;
                if(state == 0){
                    title = "未处理";
                    node = $("#noDeal")
                }else if(state == 1){
                    title = "待处理";
                    node = $("#dealing")
                }else if(state == 2){
                    title = "已消费";
                    node = $("#finish")
                }
                node.html("");
                for(var i = 0; i < data.length; ++i) {
                    var img = "http://obao.tunnel.2bdata.com/upload/product/"+data[i].product_img;
                    var str = "<li><a href='info.html?"+data[i].product_id+"' target='_parent'> <img src="+img+">";
                    var totalPrice = data[i].price*data[i].number;
                    str += " <span class='product_title' style='font-weignht: bold'>"+data[i].product_name+"</span>";
                    str += " <span class='price'>￥"+totalPrice+"</span><span class='number'>×"+data[i].number+"</span>";
                    str += " <span class='orderCode'>类别:<span>"+data[i].flavor+"/"+data[i].size+"</span></span>";
                    str += " <span class='orderTime'>取餐时间:<span  style='color: black'> "+data[i].finish_time.replace("T"," ")+"</span></span>";
                    str += " <span class='code'>取餐码:<span  style='font-weight: bold;color: green'>"+data[i].code+"</span></span>";
                    str += " <span class='state'>"+title+"</span> </a></li>";
                    node.append(str);
                }
            }
        });
    }
</script>
<header>
    <span class="back" onclick="history.go(-1)" ><</span>
    <span class="business_title_name" style="font-size: 15px;font-weight: bold">查看订单</span>
</header>
<div class="wrapper">
    <ul class="tab" style="width: 101%">
        <li class="tab-item active" onclick="order(0)">未处理</li>
        <li class="tab-item"  onclick="order(1)">待处理</li>
        <li class="tab-item" onclick="order(2)">历史订单</li>
    </ul>
    <div class="products">
        <!--待消费开始-->
        <div class="main selected unconsumed">
           <ul id="noDeal" style="margin-bottom: 50px;">
               <!--<li>-->
                   <!--<a href='info.html'>-->
                       <!--<img src="img/sp1.jpg">-->
                       <!--<span class='product_title' style="font-weignht: bold">【新品】新疆大盘鸡新品】新疆大盘鸡</span>-->
                       <!--<span class='price'>￥29.3</span>-->
                       <!--<span class='number'>×8</span>-->
                       <!--<span class='orderCode'>类别:<span>321343531313</span></span>-->
                       <!--<span class='orderTime'>取餐时间:<span  style="color: black"> 20:20:10</span></span>-->
                       <!--<span class='code'>取餐码:<span  style="font-weight: bold;color: green">4835</span></span>-->
                       <!--<span class='state'>待消费:</span>-->
                   <!--</a>-->
               <!--</li>-->
           </ul>
        </div>
        <!--待消费结束-->
        <!--待处理开始-->
        <div class="main pending">
            <ul id="dealing">

            </ul>
        </div>
        <!--待处理结束-->
        <!--全部订单开始-->
        <div class="main allOrder">
            <ul id="finish">

            </ul>
        </div>
        <!--全部订单结束-->
    </div>
</div>
</body>
<footer style="position: fixed;;bottom: -5px;width: 100%;box-shadow: 2px 0 5px 5px #f8f8ff">
    <div id="footer_top">
        <div class="navigation ">
            <a href="home.html" >
                <div class="home_img"><img class="sort"  src="http://obao.tunnel.2bdata.com/img/homepage.png">
                    <div class="spa">主页</div>
                </div>
            </a>
        </div>
        <div class="navigation">
            <a href="vieworder.html" >
                <div class="home_img"><img class="sort" src="http://obao.tunnel.2bdata.com/img/indent2.png">
                    <div class="spa" style="color:#00BB9C;">我的订单</div>
                </div>
            </a>
        </div>
        <div class="navigation">
            <a href="shopping.html" >
                <div class="home_img"><img class="sort" src="http://obao.tunnel.2bdata.com/img/shopcar.png">
                    <div class="spa">购物车</div>
                </div>
            </a>
        </div>
        <div class="navigation">
            <a href="personCenter.html" >
                <div class="home_img"><img class="sort" src="http://obao.tunnel.2bdata.com/img/user.png">
                    <div class="spa">个人信息</div>
                </div>
            </a>
        </div>
    </div>
</footer>
</footer>
</html>